package com.javasm.crm.controller.marketingActivity;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.javasm.crm.common.http.AxiosResult;
import com.javasm.crm.domin.entity.marketingActivity.Returned;
import com.javasm.crm.domin.entity.marketingActivity.clinetClaim.ReturnedFindClaim;
import com.javasm.crm.service.marketingActivity.ReturnedService;
import com.javasm.crm.utils.page.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import javafx.scene.chart.ValueAxis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author llyp
 * @since 2021-07-12
 */
@RestController
@RequestMapping("/returned")
@Api(value = "ReturnedController" ,description = "退库申请单明细")
public class ReturnedController {

    @Autowired
    private ReturnedService returnedService;

    /**
     * 条件分页查询
     * @return
     */
    @PostMapping("pagefindAll")
    @ApiOperation(value = "查询数据", notes = "查询所有数据")
    public AxiosResult<PageResult> findAll(@RequestBody ReturnedFindClaim rfc){
        PageResult<Returned> returnedPageResult = returnedService.ConditionFindPage(rfc);
        return AxiosResult.success(returnedPageResult);
    }

    /**
     * 添加
     * @param returned
     * @return
     */
    @PostMapping("add")
    @ApiOperation(value = "添加数据",notes = "添加退货申请单")
    public AxiosResult add(Returned returned){
        return AxiosResult.success(returnedService.save(returned));
    }

}
